
cjson = require "cjson.safe"
local http2tcp = require "http2tcp"
local resp = {
	msg = "ok",
	code = 0 
}

http2tcp:new("127.0.0.1", 9877)

local taskid = ngx.var.arg_taskid
local cmd    = "stats"
http2tcp:send({taskid=tonumber(taskid), is_force=0, name="", command=cmd, payload=""})

local data = http2tcp:receive()
resp.data = data
ngx.say(cjson.encode(resp))
